<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>解构赋值</title>
</head>
<body>
    <div></div>
    <script>
        //原来写法
        // let a = 1;
        // let b = 2;
        // let c = 3;
        //1、改写解构赋值
        let [a,b,c] = [1,2,3]
        console.log(a,b,c)//1,2,3
        //2、数组嵌套
        let [a2,[b2,c2]] = [1,[2,3]]
        console.log(a2,b2,c2)//1,2,3
        //3、允许空缺变量名
        let [,,a3] = [1,2,3];
        console.log(a3)//3
        //4、允许空缺值，未赋值的为undefined
        let [a4,b4,c4] = [,,3]
        console.log(a4,b4,c4)//undefined,undefined,3
    </script>
</body>
</html>